#!/bin/sh

# requirements:
#  USOCKET
#  CLX
#  CL-VECTORS
#  LOG4CL

LISP=sbcl
USOCKET_TGZ=usocket-0.4.1.tar.gz
USOCKET_URL=http://common-lisp.net/project/usocket/releases/${USOCKET_TGZ}
CL_VECTOR_TGZ=cl-vectors-0.1.3.tar.gz
CL_VECTOR_URL=http://projects.tuxee.net/cl-vectors/files/${CL_VECTOR_TGZ}
LOG4CL_URL="http://common-lisp.net/cgi-bin/viewcvs.cgi/log4cl.tar.gz?root=log4cl&view=tar"
LOG4CL_TGZ=log4cl.tar.gz
TMP_DIR=build

mkdir -p build
cd build;

wget $USOCKET_URL
if [ "$?" != "0" ] ; then
    echo cannot DL USOCKET tar ball
    exit -1
fi

wget $CL_VECTOR_URL
if [ "$?" != "0" ] ; then
    echo cannot DL cl-vector tar ball
    exit -1
fi

wget $LOG4CL_URL -O $LOG4CL_TGZ
if [ "$?" != "0" ] ; then
    echo cannot DL log4cl tar ball
    exit -1
fi

# USOCKET
$LISP <<EOF
(require 'asdf-install)
(asdf-install:install "$PWD/$USOCKET_TGZ"
2
0
EOF

# CLX
# clx does not need to download
$LISP <<EOF
(require 'asdf-install)
(asdf-install:install :clx)
2
0
EOF

# CL_VECTOR
$LISP <<EOF
(require 'asdf-install)
(asdf-install:install "$PWD/$CL_VECTOR_TGZ")
2
0
EOF

# log4cl
$LISP <<EOF
(require 'asdf-install)
(asdf-install:install "$PWD/$LOG4CL_TGZ")
2
0
EOF

